<template>
  <div id="app">
    <!--    头部-->
    <myHeader title="购物车" bgc="#FF5D1DFF" fontColor="#fff"> </myHeader>
    <myGoods v-for="item in data" :key="item.id" :obj="item"></myGoods>
    <myFooter :arr="data"></myFooter>
  </div>
</template>

<script>
import myHeader from "./components/MyHeader.vue";
import myGoods from "./components/MyGoods.vue";
import myFooter from "./components/MyFooter.vue";
export default {
  components: {
    myHeader,
    myFooter,
    myGoods,
  },
  created() {
    console.log(this);
    this.getData();
  },
  data() {
    return {
      data: [],
    };
  },
  methods: {
    async getData() {
      const res = await this.$axios({
        url: "https://www.escook.cn/api/cart",
      });
      this.data = res.data.list;
    },
  },
};
</script>

<style scoped>
#app {
  padding: 45px 0;
}
</style>
